package gs.sr.tkfx.taoke;

import gs.sr.tkfx.param.Req;

import com.taobao.api.ApiException;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.TaobaokeItemsConvertRequest;
import com.taobao.api.request.TaobaokeItemsDetailGetRequest;
import com.taobao.api.response.TaobaokeItemsConvertResponse;
import com.taobao.api.response.TaobaokeItemsDetailGetResponse;

public class Commodity {
	private static final String default_fields_get = "click_url,shop_click_url,seller_credit_score,num_iid,title,nick";
	private static final String default_fields_convert = "click_url,num_iid,commission,commission_rate,commission_num,commission_volume";

	public static TaobaokeItemsDetailGetResponse get(TaobaoClient client,
			Req tmpreq) throws ApiException {
		TaobaokeItemsDetailGetRequest req = new TaobaokeItemsDetailGetRequest();
		req.setFields(default_fields_get);
		req.setNumIids(tmpreq.getNumIids());
		req.setNick(tmpreq.getNick());
		TaobaokeItemsDetailGetResponse response = client.execute(req);

		return response;
	}

	public static TaobaokeItemsConvertResponse convert(TaobaoClient client,
			Req tmpreq) throws ApiException {
		TaobaokeItemsConvertRequest req = new TaobaokeItemsConvertRequest();
		req.setFields(default_fields_convert);
		req.setNick(tmpreq.getNick());
		req.setNumIids(tmpreq.getNumIids());
		TaobaokeItemsConvertResponse response = client.execute(req);
		return response;
	}

}
